//
//  TopBtn.m
//  YunGui
//
//  Created by Hanen 3G 01 on 16/3/22.
//  Copyright © 2016年 hanen. All rights reserved.
//

#import "TopBtn.h"
#define lineW  3.0f

@implementation TopBtn
- (id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        NSLog(@"%@+-+-+-+---+-+-+",self.titleLabel.text);
//        CGFloat width = [@"办事处统计" boundingRectWithSize:CGSizeMake(2000, 38) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName :[UIFont systemFontOfSize:15.0f]} context:nil].size.width;
        
//        self.lineView = [ViewTool getLineViewWith:CGRectMake(0, frame.size.height - lineW, frame.size.width, lineW) withBackgroudColor:BlueColor];
        
//        self.lineView = [ViewTool getLineViewWith:CGRectMake((frame.size.width - width)/2, frame.size.height - lineW, width, lineW) withBackgroudColor:BlueColor];
        
//        [self addSubview:self.lineView];
        }
    return self;
}
- (void)setTitle:(NSString *)title{
    _title = title;
    CGFloat width = [_title boundingRectWithSize:CGSizeMake(2000, 38) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName :self.titleLabel.font} context:nil].size.width;
    
    self.lineView = [ViewTool getLineViewWith:CGRectMake((self.frame.size.width - width)/2 -5, self.frame.size.height - lineW, width +10, lineW) withBackgroudColor:NavBackColor];
    
    [self addSubview:self.lineView];
    
}

@end
